import { request } from './request'

export function getHomeData() {
  return request({
    url: '/home',
  })
}

export function getStatistics() {
  return request({
    url: '/statistics',
  })
}

export function UpdateData(data) {
  return request({
    method: 'post',
    url: '/dml',
    data: data,
  })
}

export class Option {
  constructor(item) {
    this.title = { text: '' }
    this.tooltip = {}
    this.legend = { data: [] }
    this.xAxis = {}
    this.yAxis = {}
    this.xAxis['data'] = Object.keys(item)
    this.series = [{ name: '', type: 'bar', data: [] }]
    this.series[0].data = Object.values(item)
  }
}

// export class Option1 {
//   constructor(item) {
//     this.backgroundColor = '#2c343c'
//     this.title = { text: '', top: 10, left: 10, textStyle: { color: '#ccc' } }
//     this.tooltip = {}
//     this.legend = { data: [] }
//     this.xAxis = {}
//     this.yAxis = {}
//     this.xAxis['data'] = Object.keys(item)
//     this.series = [
//       { name: '', type: 'bar', itemStyle: { color: '#e74c3c' }, data: [] },
//     ]
//     this.series[0].data = Object.values(item)
//   }
// }
